package com.kunbo.cn.controller.core.reporting;



	import java.util.List;
	import java.util.Map;

	import javax.servlet.http.HttpServletResponse;

	import org.springframework.beans.factory.annotation.Autowired;
	import org.springframework.jdbc.core.JdbcTemplate;
	import org.springframework.stereotype.Controller;
	import org.springframework.web.bind.annotation.GetMapping;
	import org.springframework.web.bind.annotation.RequestMapping;
	import org.springframework.web.bind.annotation.RequestMethod;
	import org.springframework.web.bind.annotation.RequestParam;
	import org.springframework.web.bind.annotation.RestController;

	import com.kunbo.cn.entity.core.poundlist.PurchasePoundList;
	import com.kunbo.cn.entity.core.reporting.PurchaseReporting;
	import com.kunbo.cn.service.core.reporting.PurchaseReportingService;
	import com.kunbo.cn.service.core.sale.OrderCarryOverService;
	import com.kunbo.cn.util.retu.BuildBean;
	import com.kunbo.cn.util.retu.BuildBean1;
	import com.kunbo.cn.util.retu.Pages;
	import com.kunbo.cn.util.retu.ResultBean;
	import com.kunbo.cn.util.retu.ResultBean1;

	/**
	 *
	 * @author bjl  
	 * @date 2019年4月8日 
	 */
	@RestController
	//@Controller
	@RequestMapping("/test")
	//@RequestMapping()
	//public class testController {
	//@RequestMapping(value="getPurchPoundExports",method=RequestMethod.GET)
	public class  testController {
		@Autowired
	    private JdbcTemplate jdbcTemplate;
		@Autowired
		private PurchaseReportingService service;
		/**
		 * 采购逐车明细表
		 * @param 
		 * @return
		 */

		@GetMapping("/getPurchPoundList")
		public ResultBean1<Pages> getPurchPoundList(
				@RequestParam("supplier")String supplier,
				@RequestParam("receivingUnit")String receivingUnit,
				@RequestParam("materiel")String materiel,//缺运输单位，物料类型 司机
				@RequestParam("wagonNumber")String wagonNumber,
				@RequestParam("transport_unit")String transport_unit,
				@RequestParam("driver")String driver,
				@RequestParam("matter_type")String matter_type,
				@RequestParam("start_time")String start_time,
				@RequestParam("end_time")String end_time,
				@RequestParam("page")Integer page,
				@RequestParam("pageSize")Integer pageSize
				){
			ResultBean1<Pages> result  = new ResultBean1<Pages>();
			return BuildBean1.buildResulttoPages(result, "success", "error", service.getPurchPoundList1(supplier,receivingUnit,materiel,wagonNumber,transport_unit,driver,matter_type,start_time,end_time,page,pageSize)
	);
		}
		
		/**
		 * 采购物料统计
		 * @param 
		 * @return
		 */
		@GetMapping("/getPurchMatterCount")
		public ResultBean1<Pages> getPurchMatterCount(
				@RequestParam("supplier")String supplier,
				@RequestParam("receivingUnit")String receivingUnit,
				@RequestParam("materiel")String materiel,//缺运输单位，物料类型 司机
				@RequestParam("wagonNumber")String wagonNumber,
				@RequestParam("transport_unit")String transport_unit,
				@RequestParam("driver")String driver,
				@RequestParam("matter_type")String matter_type,
				@RequestParam("start_time")String start_time,
				@RequestParam("end_time")String end_time,
				@RequestParam("page")Integer page,
				@RequestParam("pageSize")Integer pageSize
				){
			ResultBean1<Pages> result  = new ResultBean1<Pages>();
			return BuildBean1.buildResulttoPages(result, "success", "error", service.getPurchMatterCount1(supplier,receivingUnit,materiel,wagonNumber,transport_unit,driver,matter_type,start_time,end_time,page,pageSize));
		}
		
		/**
		 * 采购单位统计
		 * @param 
		 * @return
		 */
		@GetMapping("/getPurchUnitCount")
		public ResultBean1<Pages> getPurchUnitCount(
				@RequestParam("supplier")String supplier,
				@RequestParam("receivingUnit")String receivingUnit,
				@RequestParam("materiel")String materiel,//缺运输单位，物料类型 司机
				@RequestParam("wagonNumber")String wagonNumber,
				@RequestParam("transport_unit")String transport_unit,
				@RequestParam("driver")String driver,
				@RequestParam("matter_type")String matter_type,
				@RequestParam("start_time")String start_time,
				@RequestParam("end_time")String end_time,
				@RequestParam("page")Integer page,
				@RequestParam("pageSize")Integer pageSize
				){
			ResultBean1<Pages> result  = new ResultBean1<Pages>();
			
			return BuildBean1.buildResulttoPages(result, "success", "error", service.getPurchUnitCount1(supplier,receivingUnit,materiel,wagonNumber,transport_unit,driver,matter_type,start_time,end_time,page,pageSize));
		}
		/**
		 * 采购逐车明细表导出
		 * @param 
		 * @return
		 */
		@GetMapping("/getPurchPoundExport")
		public Object[][] getPurchPoundExport(
				@RequestParam("supplier")String supplier,
				@RequestParam("receivingUnit")String receivingUnit,
				@RequestParam("materiel")String materiel,//缺运输单位，物料类型 司机
				@RequestParam("wagonNumber")String wagonNumber,
				@RequestParam("transport_unit")String transport_unit,
				@RequestParam("driver")String driver,
				@RequestParam("matter_type")String matter_type,
				@RequestParam("start_time")String start_time,
				@RequestParam("end_time")String end_time
				){
			return  service.getPurchPoundExport(supplier,receivingUnit,materiel,wagonNumber,transport_unit,driver,matter_type,start_time,end_time);

		}
		/**
		 * 采购逐车明细表新导出功能
		 * @param 
		 * @return
		 */
		@GetMapping("/getPurchPoundExports")
		//@RequestMapping(value="getPurchPoundExports",method=RequestMethod.GET)
		public void getPurchPoundExports(
				@RequestParam("supplier")String supplier,
				@RequestParam("receivingUnit")String receivingUnit,
				@RequestParam("materiel")String materiel,//缺运输单位，物料类型 司机
				@RequestParam("wagonNumber")String wagonNumber,
				@RequestParam("transport_unit")String transport_unit,
				@RequestParam("driver")String driver,
				@RequestParam("matter_type")String matter_type,
				@RequestParam("start_time")String start_time,
				@RequestParam("end_time")String end_time,
				HttpServletResponse response) {
			//HttpServletResponse response=new HttpServletResponse();
			//response.setHeader("Content-type", "text/html;charset=UTF-8");
			//response.setContentType("application/octet-stream;charset=UTF-8");//application/json
			//response.setContentType("application/json;charset=UTF-8");
			//response.setCharacterEncoding("UTF-8");
			 service.getPurchPoundExports(supplier,receivingUnit,materiel,wagonNumber,transport_unit,driver,matter_type,start_time,end_time,response);
		}
		/**
		 * 采购物料统计表导出
		 * @param 
		 * @return
		 */
		@GetMapping("/getPurchMatterCountExport")
		public Object[][] getPurchMatterCountExport(
				@RequestParam("supplier")String supplier,
				@RequestParam("receivingUnit")String receivingUnit,
				@RequestParam("materiel")String materiel,//缺运输单位，物料类型 司机
				@RequestParam("wagonNumber")String wagonNumber,
				@RequestParam("transport_unit")String transport_unit,
				@RequestParam("driver")String driver,
				@RequestParam("matter_type")String matter_type,
				@RequestParam("start_time")String start_time,
				@RequestParam("end_time")String end_time
				){
			return service.getPurchMatterCountExport(supplier,receivingUnit,materiel,wagonNumber,transport_unit,driver,matter_type,start_time,end_time);
		}
		
		
		/**
		 * 新采购物料统计表报表导出
		 * @param 
		 * @return
		 */
		@RequestMapping(value="getPurchMatterCountExports",method=RequestMethod.GET)
		public void getPurchMatterCountExports(
				@RequestParam("supplier")String supplier,
				@RequestParam("receivingUnit")String receivingUnit,
				@RequestParam("materiel")String materiel,//缺运输单位，物料类型 司机
				@RequestParam("wagonNumber")String wagonNumber,
				@RequestParam("transport_unit")String transport_unit,
				@RequestParam("driver")String driver,
				@RequestParam("matter_type")String matter_type,
				@RequestParam("start_time")String start_time,
				@RequestParam("end_time")String end_time,
				HttpServletResponse response
				){
			  service.getPurchMatterCountExports(supplier,receivingUnit,materiel,wagonNumber,transport_unit,driver,matter_type,start_time,end_time,response);
		}
		
		/**
		 * 采购单位统计
		 * @param 
		 * @return
		 */
		@GetMapping("/getPurchUnitCountExport")
		public Object[][] getPurchUnitCountExport(
				@RequestParam("supplier")String supplier,
				@RequestParam("receivingUnit")String receivingUnit,
				@RequestParam("materiel")String materiel,//缺运输单位，物料类型 司机
				@RequestParam("wagonNumber")String wagonNumber,
				@RequestParam("transport_unit")String transport_unit,
				@RequestParam("driver")String driver,
				@RequestParam("matter_type")String matter_type,
				@RequestParam("start_time")String start_time,
				@RequestParam("end_time")String end_time
				){
			return  service.getPurchUnitCountExport(supplier,receivingUnit,materiel,wagonNumber,transport_unit,driver,matter_type,start_time,end_time);//,page,pageSize
		}
		/**
		 * 新采购单位统计表报表导出
		 * @param 
		 * @return
		 */
		@RequestMapping(value="getPurchUnitCountExports",method=RequestMethod.GET)
		public void getPurchUnitCountExports(
				@RequestParam("supplier")String supplier,
				@RequestParam("receivingUnit")String receivingUnit,
				@RequestParam("materiel")String materiel,//缺运输单位，物料类型 司机
				@RequestParam("wagonNumber")String wagonNumber,
				@RequestParam("transport_unit")String transport_unit,
				@RequestParam("driver")String driver,
				@RequestParam("matter_type")String matter_type,
				@RequestParam("start_time")String start_time,
				@RequestParam("end_time")String end_time,
				HttpServletResponse response) {
			service.getPurchUnitCountExports(supplier,receivingUnit,materiel,wagonNumber,transport_unit,driver,matter_type,start_time,end_time,response);//,page,pageSize
	 }
	}

